<html><head><title>Validation (or test) data global deviance</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="Rchm.css">
</head>
<body>

<table width="100%"><tr><td>VGD(gamlss)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="R:   VGD">
<param name="keyword" value="R:   VGD1">
<param name="keyword" value="R:   VGD2">
<param name="keyword" value="R:   TGD">
<param name="keyword" value=" Validation (or test) data global deviance">
</object>


<h2>Validation (or test) data global deviance</h2>


<h3>Description</h3>

<p>
These function are useful for model selection.
The   function <code>VGD</code> helps to validate a GAMLSS model by randomly splitting 
the data into training  and validation  sets. 
It minimizes the global deviance for the training data set and 
then uses the validation set to calculate the prediction global deviance.
The function <code>VGD1</code> is identical to <code>VGD</code> but the output is a list
rather than a values as in <code>VGD</code>.
The function <code>VGD2</code> is identical to <code>VGD1</code> but it takes as argument
the new data, (<code>newdata</code>),  rather than a factor which split 
the combined data in two as  in <code>VGD</code> or <code>VGD1</code>.
The function <code>TGD</code> takes a fitted <code>gamlss</code> object and produce the test
global deviance for the new data.    
The resulting  prediction errors can be used for selecting the
distribution  of the model, the terms in the model or  degrees of freedom 
for smoothing terms.
</p>


<h3>Usage</h3>

<pre>
VGD(formula = NULL, sigma.fo = ~1, nu.fo = ~1, tau.fo = ~1, 
    data = NULL, family = NO, 
    control = gamlss.control(trace = FALSE), rand = NULL, ...)
VGD1(formula = NULL, sigma.fo = ~1, nu.fo = ~1, tau.fo = ~1, 
    data = NULL, family = NO, 
    control = gamlss.control(trace = FALSE), rand = NULL, ...)
VGD2(formula = NULL, sigma.fo = ~1, nu.fo = ~1, tau.fo = ~1, 
    data = NULL, family = NO, 
    control = gamlss.control(trace = FALSE), 
    newdata = NULL, ...)
TGD(object, newdata = NULL, ...)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>object</code></td>
<td>
a gamlss object</td></tr>
<tr valign="top"><td><code>formula</code></td>
<td>
a gamlss formula for <code>mu</code> (including the response on the left)</td></tr>
<tr valign="top"><td><code>sigma.fo</code></td>
<td>
a formula for  <code>sigma</code> </td></tr>
<tr valign="top"><td><code>nu.fo</code></td>
<td>
a formula for  <code>nu</code> </td></tr>
<tr valign="top"><td><code>tau.fo</code></td>
<td>
a formula for  <code>tau</code> </td></tr>
<tr valign="top"><td><code>data</code></td>
<td>
the data set used for the fitting</td></tr>
<tr valign="top"><td><code>newdata</code></td>
<td>
the data set to be used for validation ot test</td></tr>
<tr valign="top"><td><code>family</code></td>
<td>
a <code><a onclick="findlink('gamlss.dist', 'gamlss.family.html')" style="text-decoration: underline; color: blue; cursor: hand">gamlss.family</a></code> object </td></tr>
<tr valign="top"><td><code>control</code></td>
<td>
<code>gamlss.control</code> to be passed to <code>gamlss</code></td></tr>
<tr valign="top"><td><code>rand</code></td>
<td>
a random vector of one and two indicating whether is the training set (1) or the 
validation set (2) i.e. created in advance using something like 
<code>rand &lt;- sample(2, N, replace=T, prob=c(0.6,0.4))</code> where N is the length of the data</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
for extra arguments to be passed in the <code>gamlss</code> fit </td></tr>
</table>

<h3>Value</h3>

<p>
The function <code>VGD</code> returns a validated global deviance, 
that is,  the global deviance evaluated at the validation data. 
The functions <code>VGD1</code>, <code>VGD2</code> and <code>TGD</code> are returning a list
with component <code>oldGD</code>, <code>newGD</code>, <code>oldPE</code>, <code>newPE</code>. 
<code>oldGD</code> is the deviance of the training data, <code>newGD</code> is the deviance for 
the validation or (test) data. <code>oldPE</code> is  
the mean prediction error for the old data 
(<code>oldGD</code> divided by the number of observations in the training data).
<code>newPE</code>is the mean prediction error for the new data, 
(<code>newGD</code> divided by the number of observations in the validation (or test) data).</p>

<h3>Author(s)</h3>

<p>
Mikis Stasinopoulos <a href="mailto:d.stasinopoulos@londonmet.ac.uk">d.stasinopoulos@londonmet.ac.uk</a> and Bob Rigby <a href="mailto:r.rigby@londonmet.ac.uk">r.rigby@londonmet.ac.uk</a>
</p>


<h3>References</h3>

<p>
Rigby, R. A. and  Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), 
<EM>Appl. Statist.</EM>, <B>54</B>, part 3, pp 507-554.
</p>
<p>
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R.
Accompanying documentation in the current GAMLSS  help files, (see also  <a href="http://www.gamlss.com/">http://www.gamlss.com/</a>).
</p>
<p>
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R.
<EM>Journal of Statistical Software</EM>, Vol. <B>23</B>, Issue 7, Dec 2007, <a href="http://www.jstatsoft.org/v23/i07">http://www.jstatsoft.org/v23/i07</a>.
</p>


<h3>See Also</h3>

<p>
<code><a onclick="findlink('gamlss.dist', 'gamlss.family.html')" style="text-decoration: underline; color: blue; cursor: hand">gamlss.family</a></code>, <code><a href="gamlss.html">gamlss</a></code>,  <code><a href="deviance.gamlss.html">deviance.gamlss</a></code>
</p>


<h3>Examples</h3>

<pre>
data(abdom)
# generate the random split of the data
rand &lt;- sample(2, 610, replace=TRUE, prob=c(0.6,0.4))
# the proportions in the sample
table(rand)/610
VGD(y~cs(x,df=2),sigma.fo=~cs(x,df=1), data=abdom, family=LO, rand=rand)
VGD1(y~cs(x,df=2),sigma.fo=~cs(x,df=1), data=abdom, family=LO, rand=rand)
VGD2(y~cs(x,df=2),sigma.fo=~cs(x,df=1), data=abdom[rand==1,], family=LO,
      newdata=abdom[rand==2,] )

</pre>

<script Language="JScript">
function findlink(pkg, fn) {
var Y, link;
Y = location.href.lastIndexOf("\\") + 1;
link = location.href.substring(0, Y);
link = link + "../../" + pkg + "/chtml/" + pkg + ".chm::/" + fn;
location.href = link;
}
</script>


<hr><div align="center">[Package <em>gamlss</em> version 3.0-0 <a href="00Index.html">Index</a>]</div>

</body></html>
